﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="RuleManager.aspx.cs" Inherits="WebMMS.Manager.RuleManager" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/jquery.setBrowserClass.js"></script>
    <script type="text/javascript" src="../script/jquery.marquee.js"></script>
    <script type="text/javascript" src="../script/main.js"></script>
    <script language="javascript" type="text/javascript" src="../script/UCcalendar/WdatePicker.js"></script>
    <script type="text/javascript">
        function AddNew() {
            window.location.href = "RuleManagerAdd.aspx";
            return false;
        }

        function AllFun(Mess) {
            var strIDS = document.getElementById('<%=hdfBoxValues.ClientID%>').value;
            if (strIDS == "") {
                alert("请选择要" + Mess + "的项！");
                return false;
            }
            return confirm("确认要" + Mess + "？");
        }

        function ClickBox(obj) {
            if (obj.checked == true) {
                document.getElementById('<%=hdfBoxValues.ClientID%>').value += obj.value + ",";
            }
            else {
                document.getElementById('<%=hdfBoxValues.ClientID%>').value = document.getElementById('<%=hdfBoxValues.ClientID%>').value.replace(obj.value + ",", "");
            }
        }

        function ClickBoxAll(obj) {
            if (obj.checked == true) {
                var items = document.getElementsByName("myBox");
                for (var i = 0; i < items.length; i++) {
                    items[i].checked = true;
                    document.getElementById('<%=hdfBoxValues.ClientID%>').value += items[i].value + ",";
                }
            }
            else {
                var items = document.getElementsByName("myBox");
                for (var i = 0; i < items.length; i++) {
                    items[i].checked = false;
                }
                document.getElementById('<%=hdfBoxValues.ClientID%>').value = "";
            }
        }
    </script>
    <style type="text/css">
        .lbCursor
        {
            cursor: pointer;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="Form1" runat="server">
    <div align="center">
        <table>
            <tr>
                <td style="text-align: right;">
                    PID：
                </td>
                <td style="text-align: left;">
                    <asp:DropDownList ID="ddlPID" runat="server" CssClass="dropnormal">
                    </asp:DropDownList>
                </td>
                <td style="text-align: right;">
                    AppID：
                </td>
                <td style="text-align: left;">
                    <asp:DropDownList ID="ddlAppID" runat="server" CssClass="dropnormal">
                    </asp:DropDownList>
                </td>
                <td style="text-align: right;">
                    任务类型：
                </td>
                <td style="text-align: left;">
                    <asp:DropDownList ID="ddlTaskType" runat="server" CssClass="dropnormal">
                    </asp:DropDownList>
                </td>
                <td style="text-align: right;">
                    状态：
                </td>
                <td style="text-align: left;">
                    <asp:DropDownList ID="ddlStatus" runat="server">
                        <asp:ListItem Value="-1" Text="全部"></asp:ListItem>
                        <asp:ListItem Value="0" Text="关闭"></asp:ListItem>
                        <asp:ListItem Value="1" Text="开启"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;" colspan="2">
                    创建时间From：
                </td>
                <td style="text-align: left;" colspan="2">
                    <input class="Wdate" id="inputDateFrom" name="inputDateStart" runat="server" type="text"
                        onclick="WdatePicker()" />
                </td>
                <td style="text-align: right;">
                    To：
                </td>
                <td style="text-align: left;" colspan="3">
                    <input class="Wdate" id="inputDateTo" name="inputDateStart" runat="server" type="text"
                        onclick="WdatePicker()" />
                </td>
            </tr>
            <tr>
                <td colspan="10" align="center">
                    <asp:Button ID="btnQuery" runat="server" Text="查 询" CssClass="button_green" Width="70px"
                        OnClick="btnQuery_Click" />
                </td>
            </tr>
        </table>
        <br />
        <div style="width: 100%; text-align: left;">
            <asp:Button ID="btnON" Text="开 启" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('开启');" OnClick="btnON_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnOff" Text="关 闭" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('关闭');" OnClick="btnOff_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnDeleteAll" Text="删 除" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('删除');" OnClick="btnDeleteAll_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnADDNew" runat="server" Text="添加规则" OnClientClick="return AddNew();"
                CssClass="button_blue" />&nbsp;&nbsp;&nbsp;&nbsp;PID+APPID确定唯一任务！
        </div>
        <asp:GridView ID="GVinfo" runat="server" AutoGenerateColumns="False" CssClass="reason_box"
            Font-Size="12px" CellPadding="0" BorderWidth="0px" BorderColor="#A6E1FF" Width="100%"
            OnRowDataBound="GVinfo_RowDataBound" OnRowDeleting="GVinfo_RowDeleting" AllowPaging="True"
            PageSize="15">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <input type="checkbox" name="myBox" id="cbox" value='<%# Eval("ID") %>' onclick="ClickBox(this)" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <input type="checkbox" name="myBoxAll" id="cboxAll" onclick="ClickBoxAll(this)" />
                    </HeaderTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="PID">
                    <ItemTemplate>
                        <asp:Label ID="lbPID" runat="server" Text='<%# Bind("PID") %>' CssClass="lbCursor"
                            ToolTip='<%# Bind("PValue") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="AppID">
                    <ItemTemplate>
                        <asp:Label ID="lbAppID" runat="server" Text='<%# Bind("AppID") %>' CssClass="lbCursor"
                            ToolTip='<%# Bind("APPValue") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="任务类型">
                    <ItemTemplate>
                        <asp:Label ID="lbTypeName" runat="server" Text='<%# Bind("TypeName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="任务">
                    <ItemTemplate>
                        <asp:Label ID="lbTasklIDs" runat="server" Text='<%# Bind("TasklIDs") %>' CssClass="lbCursor"></asp:Label>
                        <asp:HiddenField ID="hsfID" runat="server" Value='<%# Bind("NotificationID") %>' />
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="开启时间">
                    <ItemTemplate>
                        <asp:Label ID="lbTimes" runat="server" Text='<%# Bind("Timer") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="次数">
                    <ItemTemplate>
                        <asp:Label ID="lbPcount" runat="server" Text='<%# Bind("Pcount") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="是否隔天">
                    <ItemTemplate>
                        <asp:Label ID="lbIsNext" runat="server" Text='<%# Bind("IsNext") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="状态">
                    <ItemTemplate>
                        <asp:Label ID="lbStatus" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="创建时间">
                    <ItemTemplate>
                        <asp:Label ID="lbCreateTime" runat="server" Text='<%# Bind("CreateTime") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="管理" ItemStyle-Wrap="false">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="删除" OnClientClick="return confirm('确定要删除？')"></asp:LinkButton><asp:HiddenField
                                ID="HF2" runat="server" Value='<%#Eval("ID") %>' />
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" Width="80px" />
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <span style="color: Red; font-weight: bold;">没有数据！</span>
            </EmptyDataTemplate>
        </asp:GridView>
        <div style="padding-top: 10px; text-align: right;">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged"
                PageSize="30" FirstPageText="首页" LastPageText="末页" NextPageText="下一页" PrevPageText="上一页"
                ShowBoxThreshold="999">
            </webdiyer:AspNetPager>
        </div>
        <asp:HiddenField ID="hdfBoxValues" runat="server" />
    </div>
    </form>
</asp:Content>
